package com.leap.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.leap.entity.Interact;
import com.leap.entity.InteractComment;
import com.leap.mapper.InteractCommentMapper;
import com.leap.service.InteractCommentService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class InteractCommentServiceImpl extends ServiceImpl<InteractCommentMapper, InteractComment> implements InteractCommentService {


    @Override
    public List<Long> getInteractCommentsByAccountIdInMQL(Long accountId) {

        LambdaQueryWrapper<InteractComment> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(InteractComment::getAccountId, accountId);
        queryWrapper.orderByDesc(InteractComment::getCreateTime);
        List<InteractComment> list = this.list(queryWrapper);

        List<Long> idList = list.stream().map(InteractComment::getCommentId).toList();

        return idList;
    }
}
